home *** CD-ROM | disk | FTP | other *** search
/ APC & TCP 4 / APC & TCP 4.iso / games / publicdomain / a / attacks / sources / header.def < prev    next >
Text File  |  1994-05-14  |  5KB  |  99 lines

  1. DEFINITION MODULE header;
  2.  
  3. (*      This holds all the types, constants, and global variables to   *)
  4. (* be used for the ataxx program.  Everything must therefore explicit- *)
  5. (* ly import these types as needed.  Data hiding is not used here, but *)
  6. (* the types are organized in a decent way.                            *)
  7.  
  8.  
  9. (****************************************)
  10.         CONST
  11. (****************************************)
  12.  
  13. boardsize = 7;                 (* Dimensions of the square playing area   *)
  14.  
  15. maxmovetypemoves = 200;        (* Maximum number of moves in movetype     *)
  16.  
  17.  
  18. (****************************************)
  19.         TYPE
  20. (****************************************)
  21.  
  22. squaretype = (empty, block, red, blue);         (* All the possible states *)
  23.                                                 (*  of a single square.    *)
  24.  
  25. playertype = [red..blue];                       (* The players.            *)
  26.  
  27. boardrange = [-1..boardsize + 2];       (* Limits the values of the board  *)
  28.                                         (* locations.                    *)
  29.  
  30. boardtype = ARRAY [-1..boardsize + 2], [-1..boardsize + 2] OF squaretype;
  31.  
  32. histnodeptrtype = POINTER TO histnodetype;   (* points of a history node *)
  33.  
  34. histnodetype = RECORD                   (* Each node contains the board of *)
  35.         board : boardtype;              (*  before the move, a pointer to  *)
  36.         turn : playertype;              (*  the node that shows the board  *)
  37.         previous : histnodeptrtype;     (*  before that move, after that   *)
  38.         next : histnodeptrtype;         (*  move (if any), and whose turn  *)
  39.       END;                              (*  it was at that move.           *)
  40.  
  41. historytype = RECORD                    (* The main variable for a list of *)
  42.         currentmove : histnodeptrtype;  (*  boards.  They are strung out   *)
  43.         nummoves : CARDINAL;            (*  in reverse order (most recent  *)
  44.       END;                              (*  is pointed at).                *)
  45.  
  46. statetype = RECORD                      (* This describes the current state *)
  47.         board : boardtype;              (*  of the game: the status of all  *)
  48.         turn : playertype;              (*  the squares on the board, whose *)
  49.         history : historytype;          (*  turn it is to move, and all the *)
  50.      END;                               (*  previous moves.                 *)
  51.  
  52. movetype = RECORD                       (* This describes an actual move, *)
  53.         fromX, toX,                     (*  not a board position.         *)
  54.         fromY, toY : boardrange;
  55.      END;
  56.  
  57. allmovestype = RECORD                   (* Holds LOTS of moves!           *)
  58.         nummoves : CARDINAL;
  59.         moves : ARRAY [1..maxmovetypemoves] OF movetype;
  60.      END;
  61.  
  62. pointercode = (RedCircle, BlueCircle,    (* These are the codes for the   *)
  63.                RedPointer, BluePointer,  (*  possible pointers for the    *)
  64.                EmptySquare, BlockSquare, (*  routine, ChangePointer in    *)
  65.                DefaultPointer);          (*  ataxxgraphics module.        *)
  66.  
  67. thinkertype = (human, computer);         (* The two types of players.     *)
  68.  
  69. printmsgtype = (GameOver, Thinking);     (* Message to print at top of    *)
  70.                                          (*  screen.                      *)
  71.  
  72. (****************************************)
  73. (*      GLOBALS                         *)
  74. (****************************************)
  75.  
  76. VAR
  77.  
  78. state : statetype;              (* Many things will access this.  It    *)
  79.                                 (*  describes the current state of the  *)
  80.                                 (*  game.                               *)
  81.  
  82. gameover : BOOLEAN;             (* Indicates when the game is over (or  *)
  83.                                 (*  that there are no more moves left   *)
  84.                                 (*  to play).                           *)
  85.  
  86. currentpointer : pointercode;   (* which pointer is being displayed.   *)
  87.  
  88. difficulty : CARDINAL;          (* This tells how nasty the compter is *)
  89.                                 (*  to play.  0 is easiest, and the    *)
  90.                                 (*  higher the number, the harder!     *)
  91.  
  92. whoisred,                       (* These tell who is playing what      *)
  93. whoisblue : thinkertype;        (*  color--human, or the computer.     *)
  94.  
  95. backedup : BOOLEAN;             (* Is true when the player just backed  *)
  96.                                 (*  up a move.                          *)
  97.  
  98. END header.
  99.